﻿using KillBill.Presentation.Common;
using KillBill.Presentation.Modules.Products.ProductsServiceReference;
using KillBill.Presentation.Modules.Products.IView;

namespace KillBill.Presentation.Modules.Products.Presenter
{
    public class ProductListPresenter
    {
        public IProductList View { get; set; }

        private readonly ProductsServiceClient _service;

        public ProductListPresenter(IProductList view)
        {
            _service = new ProductsServiceClient();
            View = view;
            View.Products = _service.GetProducts(Context.SessionID).Products;
        }

        public void Find(string value)
        {
            View.Products = _service.FindProducts(value, Context.SessionID).Products;
        }
    }
}
